<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>    
<%@ taglib prefix="display" uri="http://displaytag.sf.net" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %> 
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>  
<!--pub_lista_serv_in.jsp-->
<script type="text/javascript">
    $(document).ready(function () {
        $('#listServizi').jtable({
        	defaultDateFormat: 'dd/mm/yy',
        	paging: true,
        	pagesize: 10,
        	pageList: 'minimal',
        	sorting: 'true',
            title: 'Lista Servizi SCAMBIO CORSE in Entrata',
            actions: {
                listAction: '<%=request.getContextPath()%>/areaPubblica/ajax/loadServiziIN.html',
            },
            fields: {
                idServ: {
                    key: true,
                    width: '3%'
                },
                stato: {
                    title: 'STATO',
                    width: '5%',
                    display:	function (data) {
                    	
                    	if (data.record.coda) {
	                    	if (data.record.coda.esito == 1) {
	                    		return '<img src="<%=request.getContextPath()%>/images/okorange.png" alt="IN ATTESA DI CONFERMA"/>';
	                    	} else if (data.record.coda.esito == 2) {
	                    		return '<img src="<%=request.getContextPath()%>/images/okgreen.png" alt="SERVIZIO ASSEGNATO A TE!"/>';
	                    	} else if (data.record.coda.esito == 3){
	                    		return '<img src="<%=request.getContextPath()%>/images/kored.png" alt="ASSEGNATO AD UN ALTRO AUTISTA"/>';	
	                    	} 
                    	}else {
                    		return '&nbsp;';
                    	}
                    }
                    	
                },
                utente: {
                    title: 'Utente',
                    width: '5%',
                    listClass: 'grassetto',
                    display:	function (data) {
	                        return   '<a href="profiloUtente.html?idUser='+data.record.userInse.idUser+'"> '+data.record.userInse.nome + ' ' + data.record.userInse.cognome+' </a>';
                    }
                },
                oraJson: {
                    title: 'Ora',
                    width: '3%',
                    sorting: false,
                },
                dataJson: {
                    title: 'Data',
                    width: '7%',
                    type: 'date',
                    listClass: 'grassetto'
                },
                pax : {
                    title: 'Pax',
                    width: '3%',
                    sorting: false
                },
                pickUpToken: {
                    title: 'Pick up',
                    width: '17%'
                },
                dropOffToken: {
                    title: 'Drop off',
                    width: '17%'
                },
                
                prezzo: {
                    title: 'Pagano',
                    width: '4%',
                    listClass: 'grassetto',
                    defaultValue: '0',
                    display:	function (data) {
	                    if (data.record) {
	                        return '&euro; ' + data.record.prezzo;
	                    } 
                    }
                	
                },
                commissione: {
                    title: 'Commissione',
                    width: '4%',
                    listClass: 'grassetto',
                    display:	function (data) {
	                    if (data.record) {
	                        return '&euro; ' + data.record.commissione;
	                    } 
                    }
                	
                },
                descTipoServizio: {
                    title: 'Tipo Corsa',
                    width: '8%',
                    edit: false,
                    create: false,
				    sorting: false
                },
                note: {
                    title: 'note',
                    width: '8%',
                    edit: false,
                    create: false,
				    sorting: false
                },
                Dettaglio: {
                    title: '',
                    sorting: false,
                    edit: false,
                    create: false,
                    width: '1%',
       	             display: function (data) {
       	                 return '<a class="lentina" href="<%=request.getContextPath()%>/areaPubblica/dettaglioServizio.html?idServ='+data.record.idServ+'&caller=<c:out value="${caller}" /> ">'+'<img src="<%=request.getContextPath()%>/i/lente.png" height="18" width="18" alt="Visualizza Dettaglio" /></a>';
       	             }
                }
            }
        });
        
        $('#listServizi').jtable('load');

    });
    
    
    
    

    
</script>


	<!-- INIZIO CONTENUTO -->
	<p>
<a href="inserimentoServizio.html" id="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icons insertButton" role="button" aria-disabled="false">
<span class="ui-button-icon-primary ui-icon 	ui-icon-plusthick"></span>
<span class="ui-button-text">Inserisci Servizio</span>
</a></p>
			
<div id="listServizi" class="listaJtable"></div>
	<!-- FINE CONTENUTO -->




			
			<div class="gen_div">
 				<h3> 
					Suggerimenti
				</h3>
				<p>
					Questa pagina mostra tutti i servizi dell'area pubblica per i quali sei in attesa o che hai gia' eseguito
				</p>
				<p>
					<strong>OPER</strong>: Clicka sulla lente per avere il dettaglio 
				</p>																											
			</div>















<%-- <display:table name="listaServizi" id="s" pagesize="40" export="true" > --%>
<%-- 			<display:column title="Proprietario" sortable="true" headerScope="col" > --%>
<%-- 				<a href="profiloUtente.html?idUser=<c:out value="${s.userInse.idUser}"/>"> <c:out value="${s.userInse.login}"/> </a> --%>
<%-- 			</display:column> --%>
<%-- 			<display:column title="DATA" sortable="true" headerScope="col" ><c:out value="${s.data}"/></display:column> --%>
<%-- 			<display:column title="ORA" sortable="false" headerScope="col"><c:out value="${s.ore}"/>:<c:out value="${s.minuti}"/></display:column> --%>
<%-- 			<display:column title="PICKUP" sortable="true" headerScope="col"> --%>
<%-- 				<c:choose> --%>
<%-- 					<c:when test="${dettaglio.idUser == s.idUserInse or dettaglio.idUser == s.idUserExec }"> --%>
<%-- 						<c:out value="${s.pickUp}"/> --%>
<%-- 					</c:when> --%>
<%-- 					<c:otherwise> --%>
<%-- 						<c:out value="${s.pickUpToken}"/> --%>
<%-- 					</c:otherwise> --%>
<%-- 				</c:choose> --%>
<%-- 			</display:column> --%>
		
<%-- 			<display:column title="DROPOFF" sortable="true" headerScope="col">  --%>
<%-- 				<c:choose> --%>
<%-- 					<c:when test="${dettaglio.idUser == s.idUserInse or dettaglio.idUser == s.idUserExec }"> --%>
<%-- 						<c:out value="${s.dropOff}"/> --%>
<%-- 					</c:when> --%>
<%-- 					<c:otherwise> --%>
<%-- 						<c:out value="${s.dropOffToken}"/> --%>
<%-- 					</c:otherwise> --%>
<%-- 				</c:choose> --%>
<%-- 			</display:column> --%>
			
<%-- 			 <display:column title="Pax" headerScope="col"><c:out value="${s.pax}"/></display:column> --%>
<%--  			 <display:column title="Pagano" sortable="true" headerScope="col" media="html"> --%>
<%--  			 			<c:out value="${s.prezzo}"/>&euro; --%>
<%--  			 </display:column> --%>
<%--  			 <display:column title="Commissione" sortable="true" headerScope="col" media="html"> --%>
<%--  			 			<c:out value="${s.commissione}"/>&euro; --%>
<%--  			 </display:column> --%>
 		
 		
<%--  			 <display:column title="STATO" sortable="true" headerScope="col" media="html"> --%>
<%--  			 		<c:choose> --%>
<%--  			 			<c:when test="${s.coda.esito == 1 }" > --%>
<%-- 	 			 			<img src="<%=request.getContextPath()%>/images/okorange.png" alt="IN ATTESA DI CONFERMA"/> --%>
<%-- 	 			 		</c:when> --%>
<%-- 	 			 		<c:when test="${s.coda.esito == 2 }" > --%>
<%-- 	 			 			<img src="<%=request.getContextPath()%>/images/okgreen.png" alt="SERVIZIO ASSEGNATO A TE!"/> --%>
<%-- 	 			 		</c:when> --%>
<%-- 	 			 		<c:when test="${s.coda.esito == 3 }" > --%>
<%-- 	 			 			<img src="<%=request.getContextPath()%>/images/kored.png" alt="ASSEGNATO AD UN ALTRO AUTISTA"/> --%>
<%-- 	 			 		</c:when>	 			 		 --%>
<%--  			 		</c:choose> --%>
<%--  			 </display:column>  --%>
 			 			
 			 			
<%-- 			 <display:column title="OPER" headerScope="col" media="html" > --%>
<%-- 			 		<a href="dettaglioServizio.html?idServ=<c:out value="${s.idServ}" />&caller=<c:out value="${caller}" />" ><img src="<%=request.getContextPath()%>/images/dettaglio.png" alt="DETTAGLIO SERVIZIO"/></a> --%>
<%-- 			 </display:column> --%>
<%-- 			 <display:footer media="excel pdf html"> --%>
<!-- 				 <div> -->
<!-- 				 <tr style="background-color: silver; color: black; font-size: 0.7em"> -->
<!-- 					 	<td colspan="12">&nbsp;</td> -->
		 			 	
<!-- 	 			 </tr> -->
<!--  			 	</div> -->
	 			 
<%-- 			 </display:footer> --%>
<%-- </display:table>   --%>
				
				

</div>
		</div>	
			